Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

JavaScript 是如何被執行的 (1)?

JavaScript 是如何被執行的 (1)?

十分鐘、五步驟,SVG 動起來!

十分鐘、五步驟,SVG 動起來!

let 與 const  與 Arrow Function

let 與 const 與 Arrow Function


Comments